var socket = io.connect();
socket.on('page load', function (data) {
    console.log(data);
});

socket.on('poll update client', function (results) {
	console.log(results);
	for (index in results){
		$('#poll-results .poll li#result-' + results[index].name + '-'+ index + ' span.value').html(results[index].value);
  }
});

$(document).ready(function(){
	$('#poll-submit-form-submit').click(function(e){
		if($('[name=poll-option]:checked').val()){
			socket.emit('poll update', $('[name=poll-option]:checked').val());
			//e.preventDefault();
		}
	});
})
